<?php
 
class TransactionCentral_Card_Transaction_Credit extends TransactionCentral_CurlTransaction
{
    protected $card_trans;
    
    public function __construct(TransactionCentral_Card_Transaction $card_trans)
    {
         $this->card_trans = $card_trans;
    }
    
    public function process()
	{
	    $card_trans = &$this->card_trans;
	    
	    if($card_trans->trans_id == null || $card_trans->trans_id == '' || $card_trans->amount == null || $card_trans->amount == '' || $card_trans->RefId || $card_trans->Re) {
	        throw new Exception('Must pass ' . get_class($this) . '::' . __FUNCTION__ . 'at least TransID and Amount.');
	    }
		
		return self::curlTransaction(TransactionCentral_Card_Transaction::CC_TRANS_URL, 
		                             TransactionCentral_Transaction::CC_CREDIT, array(
                        	                                                            'MerchantID'=> TransactionCentral_Transaction::MERCH_ID,
                                		                                                'RegKey'	=> TransactionCentral_Transaction::REG_KEY,
                        	                                                            'TransID'	=> $card_trans->getTransId(),
                        	                                                            'Amount'	=> $card_trans->getAmount(),
                        	                                                            'RefID'		=> $card_trans->getRefId()
                        	                                                        ));
    }
    
   
}